<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // var arr = ["a", "b", "c"];
        // console.log(arr); 
        // console.log(arr[0],arr[1],arr[2]); 
        // // 展开数组
        // console.log(...arr);

        // var arr1 = [arr[0],arr[1],arr[2]]
        // arr1[0] = "aaa";
        // console.log(arr);

        // var arr1 = [0, ...arr, "d"];
        // arr1[0] = "aaa";
        // console.log(arr);
        // console.log(arr1);

        // 浅复制
        // var arr1 = arr;
        // arr1[0] = "aaa";
        // console.log(arr);


        var obj = {
            name:"lili",
            age:18,
        }

        // 对象的展开
        var obj1 = {
            ...obj,
            phone:37827382
        }
        // console.log(obj1);


        var a = 10;

        var obj2 = {
            a,   //a:a,   // 属性名:变量名, 当属性名和变量名一样的时候,可以简写一个属性名
            name:"obj2",
            run:function(){
                console.log("run",this); //obj2
            },
            run1(){  //函数的简写
                console.log("run1111",this); //obj2
            },
            age:18,
        }
        console.log(obj2.a);

        obj2.run();
        obj2.run1();


        // obj = {
        //     name:"nana"
        // };
        // console.log(obj.name);
        // console.log(obj["name"]);

        // obj["age"] = 10;
        // obj.age = 6;

        // for(var k in obj){
        //     console.log(k); // "name"  "age"
        //     console.log(obj[k]);
        // }
        

    </script>
</body>

</html>